package vip.xiaonuo.hontu.issued.util;

public class AesDemo {

    public static void main(String[] args) {
        aesEncryptDemo();
        aesDecryptDemo();
    }

    /**
     * aes解密demo
     */
    public static void aesDecryptDemo() {
        // 加密因子:
        String key = "64d64143a0973fb8";
        // 从openapi 获取到的密文身份证号
        String encryptIdentifyNumFromOpenapi = "9397D1730FE8F05B391CDBADA3A2B0135DA552D20978757513C14BE3D57019D2";
        // 使用aes解密得到明文身份证号
        String identifyNumAfterDecrypt = AESUtil.decrypt(encryptIdentifyNumFromOpenapi, key);
        System.out.println(identifyNumAfterDecrypt);
    }

    /**
     * aes加密demo
     */
    public static void aesEncryptDemo() {
        // 加密因子:
        String key = "64d64143a0973fb8";
        // 明文身份证号
        String identifyNum = "510222199809076543";
        // 使用aes加密得到密文身份证号
        String encryptIdentifyNum = AESUtil.encrypt(identifyNum, key);
        System.out.println(encryptIdentifyNum);
    }
}